import {defineStore} from 'pinia'

export const usePersonStore  = defineStore('personStore', {
    state: () => {
        return{
            username: '张三',
            age: 22,
            hobbies: ['唱歌', '跳舞']
        }
    },
    getters: {
        getHobbyCount: (state) => 
            state.hobbies.length
        ,
        getAge() {
            return this.age
        }
    },
    actions: {
        doubleAge() {
            this.age = this.age * 2
        }
    }
})